<template>
	<div class="mine-content" style="margin-bottom: 0;margin-top: 0;">
		<div class="company-name">
			<span class='orderNumber'>{{orderNo}}</span>
		</div>
		<div class="tlg">

		</div>

		<!--过磅列表 -->
		<ul class="ponderList">
			<li v-for="(item,index) in ponderList" :key=index @click="ponderInfoClick(item.carNo,item.orderNo,item.isPoundOrderConfirm,item.enterStatus,item.carId,item.orderType)">
				<p>
					<em>{{item.carNo}}</em>
					<img src="../../images/right.png" />
				</p>
				<p>
					<span>司机姓名</span>
					<b>{{item.driver?item.driver:''}}</b>
				</p>
				<p>
					<span>装车重量</span>
					<b>{{item.weight?item.weight:''}} <em>吨</em></b>
				</p>
				<p>
					<span>司机电话</span>
					<b>{{item.phone}}</b>
				</p>
				<p>
					<span>司机身份证</span>
					<b>{{item.idCard}}</b>
				</p>
				<p>
					<span>入场时间</span>
					<b>{{item.uploadTime?item.uploadTime.slice(0,19):''}}</b>
				</p>
				<p>
					<i :class="item.enterStatus | statusColor">{{item.enterStatus | statusName}}</i>
				</p>

			</li>
		</ul>
	</div>
</template>

<script>
	import {
		getPoundList
	} from '../../config/api'
	import {
		getStore
	} from '../../config/mUtils'
	export default {
		data() {
			return {
				orderNo: this.$route.query.orderNo,
				status: this.$route.query.status,
				ponderList: []
			}
		},
		mounted() {
			getPoundList(getStore('SupplierId'), this.orderNo).then(res => {
				console.log(res)
				if (res.code == 100) {
					this.ponderList = res.content
				}
			})
		},
		methods: {
			ponderInfoClick(carNo, orderNo, dataStatus, enterStatus, carId, orderType) {
				if (this.status == 1 && orderType==null) {
					console.log(1)
					this.$router.push({
						path: '/ponderationInformation',
						query: {
							carNo,
							orderNo,
							dataStatus,
							enterStatus,
							status: 1
						}
					})
				} else if (this.status == 1 && orderType == 2) {
					this.$router.push({
						path: '/mutongponderInformation',
						query: {
							enterStatus,
							carId
						}
					})
				} else if (this.status == 2 && orderType == 1) {
					this.$router.push({
						path: '/ponderationInformation',
						query: {
							carNo,
							orderNo,
							dataStatus,
							enterStatus,
							status: 2
						}
					})
				} else {
					this.$router.push({
						path: '/mutongponderInformation',
						query: {
							enterStatus,
							carId
						}
					})
				}
			}
		},
		filters: {
			statusColor(value) {
				switch (value) {
					case '0':
						return 'colorTwo';
					case '1':
						return 'colorFour';
					case '3':
						return 'colorThree';
					default:
						return 'colorOne'
				}
			},
			statusName(value) {
				switch (value) {
					case '0':
						return '未入场';
					case '1':
						return '已入场';
					case '2':
						return '可出场';
					case '3':
						return '已出场';
					default:
						return
				}
			}
		}
	}
</script>

<style scoped="scoped" lang="less">
	.mine-content .ponderList li p {
		.colorOne {
			border-color: #fdb96e;
			color: #fdb96e
		}

		.colorTwo {
			border-color: #f65555;
			color: #f65555
		}

		.colorThree {
			border-color: #777777;
			color: #777777
		}

		.colorFour {
			border-color: #28c81e;
			color: #28c81e
		}
	}
</style>
